package io.xccit.oshiapp.controller;

import io.xccit.oshiapp.common.r.AjaxResult;
import io.xccit.oshiapp.common.service.ICpuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author CH_ywx
 * @version 1.0
 * @create 2024/12/14
 * <p>cpu信息控制层</p>
 */
@RestController
@RequestMapping("/monitor/cpu")
public class CpuController {

    @Autowired
    private ICpuService cpuService;
    @GetMapping("/info")
    public AjaxResult getCpuInfo(){
        return AjaxResult.success(cpuService.getCpuInfo());
    }

    @GetMapping("/freq")
    public AjaxResult getCpuFreq(){
        return AjaxResult.success(cpuService.getCpuCoreUsagePerSecond());
    }
}
